﻿

      function City(p_city, p_text) {

          window.location.href = "http://" + p_text + "<%=hostname %>";
      }

      function More_Show1(element) {

          var pos = GetObjPos(element);

          var iX = pos.x;
          var iY = pos.y;

          document.getElementById("More1").style.left = (iX - 100) + "px";
          document.getElementById("More1").style.top = (iY - 10) + "px";
          document.getElementById("More1").style.height = 300;
          document.getElementById("More1").style.display = "inline";

          chang1(1);


      }

      function chang1(chars) {

          for (var i = 1; i < 27; i++) {
              var obj = document.getElementById("char_" + i);
              obj.className = "Gray";

          }
          var obj = document.getElementById("char_" + chars);
          obj.className = "yl";

          document.getElementById("citylist").innerHTML = SZ168.Ajax.ServiceSearch.GetCity(chars).value;

      }

      function MoreClose1() {
          document.getElementById("More1").style.display = "none";
      }

      function CPos(x, y) {
          this.x = x;
          this.y = y;
      }
      function GetObjPos(ATarget) {
          var target = document.getElementById(ATarget);
          var pos = new CPos(target.offsetLeft, target.offsetTop);
          var target = target.offsetParent;
          while (target) {
              pos.x += target.offsetLeft;
              pos.y += target.offsetTop;
              target = target.offsetParent;
          }
          return pos;
      }

      function $obj(o) { return document.getElementById(o); }
      function switchmodTag(modtag, modcontent, modk, classname, tag) {
          for (i = 1; i < 6; i++) {
              var n = i + tab1 * 5;
              switch (tag) {
                  case 1:
                      n = i + tab1 * 5;
                      break;
                  case 2:
                      n = i + tab2 * 5;
                      break;
                  case 3:
                      n = i + tab3 * 5;
                      break;
              }
              if (i == modk) {
                  $obj(modtag + i).className = classname; $obj(modcontent + '_' + n).style.display = '';
              }
              else {
                  $obj(modtag + i).className = ""; $obj(modcontent + '_' + n).style.display = 'none';
              }
          }
      }

      function switchmodTag2(modtag, modcontent, modk, classname, num) {
          for (i = 1; i < num; i++) {
              if (i == modk) {
                  $obj(modtag + i).className = classname; document.getElementById(modcontent + '_' + i).style.display = 'block';
              }
              else {
                  $obj(modtag + i).className = ""; document.getElementById(modcontent + '_' + i).style.display = 'none';
              }
          }
      }

      var tab1 = 0, tab2 = 0, tab3 = 0;

      function ShowTab(list, ID, tab, mod, modlist, tag) {
          var m = 0;
          for (i = 1; i < 4; i++) {
              if (i == ID) {
                  $obj(list + i).style.display = 'block';
                  $obj(tab + i).className = "yo";
                  m = i - 1;
                  switch (tag) {
                      case 1:
                          tab1 = i - 1;
                          break;
                      case 2:
                          tab2 = i - 1;
                          break;
                      case 3:
                          tab3 = i - 1;
                          break;
                  }
                  //     if (i!=1)
                  //    $obj(list + i).innerHTML = SZ168.Ajax.SelectList.sList(list, ID, estate_type_id, allareaid).value;
              }
              else {
                  $obj(list + i).style.display = 'none';
                  $obj(tab + i).className = "";
              }
          }
          for (j = 1; j < 6; j++) {
              $obj(mod + j).className = "";
              var n = m * 5 + j;
              $obj(modlist + n).style.display = 'none';
          }
          var n = m * 5 + 1;
          $obj(modlist + n).style.display = 'block';
          $obj(mod + 1).className = "chu";
      }



      /**   
      *    
      * @param {} sURL 收藏链接地址   
      * @param {} sTitle 收藏标题   
      */
      function AddFavorite(sURL, sTitle) {
          try {
              window.external.addFavorite(sURL, sTitle);
          } catch (e) {
              try {
                  window.sidebar.addPanel(sTitle, sURL, "");
              } catch (e) {
                  alert("加入收藏失败，请使用Ctrl+D进行添加");
              }
          }
      }
      /**   
      *    
      * @param {} obj 当前对象，一般是使用this引用。   
      * @param {} vrl 主页URL   
      */
      function SetHome(obj, vrl) {
          try {
              obj.style.behavior = 'url(#default#homepage)';
              obj.setHomePage(vrl);
          } catch (e) {
              if (window.netscape) {
                  try {
                      netscape.security.PrivilegeManager
                        .enablePrivilege("UniversalXPConnect");
                  } catch (e) {
                      alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
                  }
                  var prefs = Components.classes['@mozilla.org/preferences-service;1']
                    .getService(Components.interfaces.nsIPrefBranch);
                  prefs.setCharPref('browser.startup.homepage', vrl);
              }
          }
      }

      function Loginexit() {
          var userikey = getCookie("LoginiKey");
          var logina = document.getElementById("logina")
          var logine = document.getElementById("exita")
          var Publisha = document.getElementById("Publisha");
          if (userikey == null || userikey == "" || userikey == "1") {
              logina.innerHTML = "登录";
              logina.href = "http://sz.sz168.net.cn/User_Login.aspx";
              if(Publisha != null)
                  Publisha.href = "http://sz.sz168.net.cn/User_Login.aspx"
              logine.innerHTML = "";
          }
          else {
              logina.innerHTML = getCookie("User_ID");
              logina.href = "http://sz.sz168.net.cn/User_AgentBackstage.aspx";
              if (Publisha != null)
                  Publisha.href = "http://sz.sz168.net.cn/publish/cf_publish.aspx?t=1";  // /u_Estate_Publish.aspx"
              logine.innerHTML = "退出";
          }
      }

      function userExit() {
          delCookie("LoginiKey");
          delCookie("User_ID");           
          window.location.href = "/";
      }
        
